<!DOCTYPE html>
<html lang="zh">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <title>操作日志</title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <script src="/statics/js/custom/lib.js?_V=1"></script>
</head>

<body ng-app="">
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <ng-include src="'/admin/common/sidebar.html'"></ng-include>
        <!--End 左侧导航-->
        <!--头部信息-->
        <ng-include src="'/admin/common/header.html'"></ng-include>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">
            <div class="container-fluid p-t-55">

                <!--详情-->
                <div class="modal fade bs-example-modal-lg" id="detail" tabindex="-1" role="dialog"
                     aria-labelledby="myLargeModalLabel" data-backdrop="static">
                    <div class="modal-dialog modal-lg" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h6 class="modal-title">日志详情</h6>
                                <div class="float-right">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true">&times;</span>
                                    </button>
                                </div>
                            </div>
                            <div class="modal-body">
                                <div class="form-group col-md-12">
                                    <label for="title">标题</label>
                                    <input type="text" class="form-control" id="title" name="title" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="typeName">类型名称</label>
                                    <input type="text" class="form-control" id="typeName" name="typeName" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="userName">操作人名称</label>
                                    <input type="text" class="form-control" id="userName" name="userName" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="createTime">创建时间</label>
                                    <input type="text" class="form-control times" id="createTime" name="createTime" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="requestUrl">请求路径</label>
                                    <input type="text" class="form-control" id="requestUrl" name="requestUrl" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="requestParam">请求参数</label>
                                    <textarea id="requestParam" name="requestParam" class="form-control" readonly></textarea>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="returnCode">返回错误码</label>
                                    <input type="text" class="form-control" id="returnCode" name="returnCode" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="returnMessage">返回错误信息</label>
                                    <textarea id="returnMessage" name="returnMessage" class="form-control" readonly></textarea>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="returnResult">返回结果</label>
                                    <textarea id="returnResult" name="returnResult" class="form-control" readonly></textarea>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="className">类名称</label>
                                    <input type="text" class="form-control" id="className" name="className" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="methodName">方法名</label>
                                    <input type="text" class="form-control" id="methodName" name="methodName" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="ip">ip地址</label>
                                    <input type="text" class="form-control" id="ip" name="ip" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="location">位置</label>
                                    <input type="text" class="form-control" id="location" name="location" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="os">操作系统</label>
                                    <input type="text" class="form-control" id="os" name="os" readonly/>
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="browser">浏览器</label>
                                    <input type="text" class="form-control" id="browser" name="browser" readonly/>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body pt-0">
                                <header class="card-header pr-0 pl-0">
                                    <div class="card-title">操作日志</div>
                                </header>
                                <div class="clearfix p-b-10">
                                    <form class="form-inline form-space-b" id="searchForm" method="post">
                                        <div class="mx_search p-t-10">
                                            <div class="form-group m-r-10">
                                                <input class="form-control width150" type="text" name="title"
                                                       placeholder="请输入标题">
                                            </div>
                                            <div class="form-group m-r-10">
                                                <input class="form-control width150 js-datetimepicker times" autocomplete="off"
                                                       data-date-format="yyyy-mm-dd hh:ii" type="text" id="startTime"
                                                       name="startTime" placeholder="开始时间">
                                                <span class="input-group-addon" style="text-align: center;width: 30px;"><i
                                                        class="mdi mdi-chevron-right"></i></span>
                                                <input class="form-control width150 js-datetimepicker times" autocomplete="off"
                                                       data-date-format="yyyy-mm-dd hh:ii" type="text" id="endTime"
                                                       name="endTime" placeholder="结束时间">
                                            </div>
                                            <div class="d-flex justify-content-between">
                                                <a class="btn btn-primary m-r-10" id="searchButton"><i
                                                        class="mdi mdi-magnify"></i> 搜索</a>
                                                <button class="btn btn-secondary" id="resetButton"><i
                                                        class="mdi mdi-delete"></i> 重置查询</button>
                                            </div>
                                        </div>
                                        <div class="form-inline p-t-10">
                                            <a class="btn btn-danger deletes" data-toggle="modal"
                                               data-target=".removeDio" href="#!"><i class="mdi mdi-window-close"></i>
                                                删除</a>
                                        </div>
                                    </form>
                                </div>
                                <table id="tableAjaxId">
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </main>
        <!--End 页面主要内容-->
    </div>
</div>

<script type="text/javascript" src="/statics/js/apis/log.js"></script>
<script type="text/javascript" src="/statics/js/custom/table.js?_v=1.1"></script>
<script type="text/javascript">

    $(function () {
        Table.builder()
            .listUrl(LOG_LIST)
            .detailUrl(LOG_DETAIL)
            .deleteUrl(LOG_DELETE)
            .init();
    });

    columns = [
        {
            checkbox: true,
            align: 'center'
        }, {
            field: 'title',
            title: '标题',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'returnCode',
            title: '状态',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row, index) {
               if(value === "00000"){
                   return "<span style='color:green'>成功</span>";
               }else{
                   return "<span style='color:red'>失败</span>";
               }

            }
        }, {
            field: 'typeName',
            title: '类型',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'userName',
            title: '操作人',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'requestUrl',
            title: '请求路径',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row, index) {
                return Table.moreText(value);
            }
        }, {
            field: 'ip',
            title: 'ip地址',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'location',
            title: '位置',
            align: 'center',
            valign: 'middle'
        }, {
            field: 'createTime',
            title: '创建时间',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row, index) {
                return DateUtil.changeDateToString(value);
            }
        }, {
            title: "操作",
            align: 'center',
            valign: 'middle',
            width: 160,
            formatter: option
        }
    ]

    function option(value, row, index) {
        return '<a class="btn btn-xs btn-default detail m-r-5" data-toggle="modal" data-target="#detail" dataId="' + row.id + '"  title="详情" >详情</a>' +
            '<a class="btn btn-xs btn-default deletes" data-toggle="modal" data-target=".removeDio" dataId="' + row.id + '"  title="删除" >删除</a>';

    }
</script>
</body>
</html>
